<template>
  <div class="">
    <span>{{objKeys[value]}}</span>
  </div>
</template>

<script type="text/javascript">
import { ajaxGetDictItems } from '@/api/api'

export default {

  props: {
    dictCode: String,
    value: String
  },
  data() {
    return {
      objKeys: {}
    }
  },
  mounted() {
    this.getObjKeys()
  },
  methods: {
    getObjKeys(){
      ajaxGetDictItems(this.dictCode).then( res => {
        const obj = {}
        if(res.success) {
          res.data.forEach( ele => {
            obj[ele.value] = ele.text
          } )  
        }
        this.objKeys = obj
      } )
    },
  },
  components: {

  }
}
</script>

<style lang="less" scoped>
</style>
